# angle:
#   0: top
#   1: top left
#   2: bot lef
#   3: bot righ
#   4: top right
# pos[angle]: Number of step in angle position

class Position(object):
    # Initialization
    def __init__(self, pos=None):
        if pos:
            self.__angle = pos.__angle
            self.__count = list(pos.__count)
        else:
            self.__angle = 0
            self.__count = [0] * 5

    # Generate next move
    def GetNext(self):
        # we move rigth
        for rotate in [-1, 1]:
            pos = Position(self)
            pos.__count[self.__angle] += 1
            pos.__angle = (self.__angle + rotate) % 5
            yield pos

    # Do nice print
    def __str__(self):
        valb = {True: ' [', False: '  '}
        vale = {True: '] ', False: '  '}
        msg = ''
        for i in range(5):
            msg += valb[i == self.__angle]
            msg += '%2d' % self.__count[i]
            msg += vale[i == self.__angle]
        return msg

    def IsGood(self, maxstep):
        for i in range(5):
            if self.__count[i] > maxstep / 5:
                return False
        return True

    def IsOrigin(self):
        if self.__angle != 0:
            return False
        for i in range(1, 5):
            if self.__count[i] != self.__count[0]:
                return False
        return True

    # define __hash__ and __eq__ to use it in dict
    def key(self):
        return (self.__angle, tuple(self.__count))
    def __hash__(self):
        return hash(self.key())
    def __eq__(self, other):
        return self.key() == other.key()


def Solve():
    step = 70

    # Initial state
    cur = {}
    cur[Position()] = 1

    for s in xrange(step):
        # Generate next step possibiity from current one
        nex = {}
        for pos, nb in cur.items():
            for npos in pos.GetNext():
                # Check position
                if not npos.IsGood(step):
                    continue
                nnb = nex.get(npos, 0)
                nex[npos] = nb + nnb
        cur = nex

    result = 0
    for pos, nb in cur.items():
        if pos.IsOrigin():
            result += nb

    return result


if __name__ == "__main__":
    print Solve()

